/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@NONE}}.java.hbs
 */
package cn.ibizlab.core.authentication.domain;

import java.util.*;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.IEntity;
import cn.ibizlab.util.domain.EntityBase;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;

/**
 * 授权对象实体类[AuthGranted]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@ApiModel(value = "AUTH_GRANTED", description = "授权对象")
public class AuthGranted extends EntityBase implements Serializable
{

    /**
     * 资源符
     */
    @Id
    @DEField(name = "authority" , isKeyField = true)
    @JsonProperty("authority")
    @JSONField(name = "authority")
    @ApiModelProperty(value = "authority", notes = "资源符")
    private String authority;

    /**
     * 权限类型
     */
    @DEField(name = "permission_type")
    @JsonProperty("permission_type")
    @JSONField(name = "permission_type")
    @ApiModelProperty(value = "permission_type", notes = "权限类型")
    private String permissionType;

    /**
     * 显示名
     */
    @DEField(name = "display_name")
    @JsonProperty("display_name")
    @JSONField(name = "display_name")
    @ApiModelProperty(value = "display_name", notes = "显示名")
    private String displayName;


    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("authority");
        }
        return targetEntity;
    }

}